package com.springboot.base.springbootes.controller;

import com.springboot.base.springbootes.pojo.PageResult;
import com.springboot.base.springbootes.pojo.RequestParams;
import com.springboot.base.springbootes.service.HotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * @author: 船长
 * @create: 2025-03-15 16:59
 **/

@RestController
@RequestMapping("/hotel")
public class HotelController {

    @Autowired
    private HotelService hotelService;



    // 查询列表
    @PostMapping("/list")
    public PageResult search(@RequestBody RequestParams params) throws IOException {
        return hotelService.search(params);
    }

    // 聚合
    @PostMapping("/filters")
    public Map<String, List<String>> filters(@RequestBody RequestParams params) throws IOException {
         return hotelService.filters(params);
    }

    @GetMapping("/suggestion")
    public List<String> suggestion(@RequestParam("key") String prefix) throws IOException {
        return hotelService.suggestion(prefix);
    }
}
